
//  RequestBaseData.m
//  QinjinProject
//
//  Created by Michael on 14-9-13.
//  Copyright (c) 2014年 ___Michael___. All rights reserved.
//

#import "RequestBaseData.h"

@implementation RequestBaseData

@synthesize method;
@synthesize urlPath;
@synthesize parameters;
@synthesize loadingStatus;
@synthesize showLoading;

-(id)init
{
    if (self = [super init])
    {
        self.urlPath = nil;
        self.parameters = [NSMutableDictionary dictionary];
        self.loadingStatus = LOADING_NOTSTART;
    }
    
    return self;
}

-(void)getLoadData:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
           failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
   // NSLog(@"===%@",urlPath);
    [[HttpClient manager]GET:urlPath parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject)
    {
        if ([self.strDataKey isEqualToString:requestDataKey])
        {
            [self parseData:[responseObject objectForKey:self.strDataKey]];
        }else
        {
            NSDictionary * dicData = [responseObject objectForKey:requestDataKey];
            [self parseData:[dicData objectForKey:self.strDataKey]];
        }
        success(operation, responseObject);
        self.loadingStatus = LOADING_SUCCESS;
 
    } failure:^(AFHTTPRequestOperation *operation, NSError *error)
     {
         self.loadingStatus = LOADING_FAILED;
         if (failure)failure(operation, error);
 
    }];

}


-(void)postLoadData:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
           failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{



}



-(void)parseData:(id)dataObj
{
    //model封装dic
}

@end





